﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<KulaQ.Models.SurveyModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Survey
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    
    <h2>Survey</h2>

    <p id="SurveyList">
        <%: Html.DropDownList("SelectedID", new SelectList(Model.SurveyTrees, "ID", "Name", Model.SelectedID)) %>
    </p>

    <div id="SurveyArea">
        <%
            foreach (var survey in Model.SurveyTrees)
            {
                survey.ExpendAll();
                var surveyTreeView = Html.Telerik().TreeView().Name(survey.ID.ToString()).ToComponent();
                surveyTreeView.Items.Add(survey.RootNode);
                surveyTreeView.ItemAction = i =>
                {
                    if (i.Items.Count == 0)
                    {
                        i.ImageUrl = "/Content/Images/Star.gif";
                    }
                };
                surveyTreeView.Render();
            }
        %>
    </div>
</asp:Content>
